<%--
  Copyright � 2005 Obeo.
  All rights reserved.   This program and the accompanying materials
  are made available under the terms of the GNU Public License v2.0 or any later version
  which accompanies this distribution, and is available at
  http://www.gnu.org/licenses/gpl.txt
--%>
<%
metamodel http://www.eclipse.org/uml2/2.0.0/UML

import org.acceleo.modules.uml2.services.Uml2Services
import org.acceleo.modules.uml2.services.StringServices
%>

<%-- 
This template generate Data Transfert Objects.
It is used for data exchange between UI and Persistence layers
--%>


<%script type="Class" name="fullFilePath"%>
<%if (hasStereotype("Dto") || hasStereotype("Entity")){%>
/<%dtoPackage.toPath()%>/<%name%>Dto.java
<%}%>

<%script type="Class" name="generate" file="<%fullFilePath%>"%>
<%-- DTO class generation--%>
package <%dtoPackage%>;

//<%startUserCode%>
import java.io.Serializable;
import java.util.*;
//<%endUserCode%>

/**
 * <%ownedComment.body%>
 */
public class <%name%>Dto<%extensions%> implements Serializable {

	// serialVersionUID is used for serialization.
	private static final long serialVersionUID = 1L;

<%-- Generate attributes --%>
<%for (attribute){%><%if (type.filter("PrimitiveType") != null){%>
	protected <%type.name%> <%name%>;
<%}%><%}%>

	/**
	 * Default constructor 
	 */
	public <%name%>Dto() {
		super();
	}

<%-- Generate getters and setters --%>
<%for (attribute) {%><%if (type.filter("PrimitiveType") != null){%>
	/**
	 * Return <%name%>
	 * @return <%ownedComment.body%>
	 */
	public <%type.name%> get<%name.firstUpper()%>() {
		return <%name%>;
	}

	/**
	 * Set a value to parameter <%name%>.
	 * @param <%name%> <%ownedComment.body%>
	 */
	public void set<%name.firstUpper()%>(<%type.name%> <%name%>) {
		this.<%name%> = <%name%>;
	}
	
<%}%><%}%>
}

<%script type="Class" name="dtoPackage"%>
org.acceleo.sample.dto
<%script type="Class" name="extensions"%>
<%-- Manage extensions --%>
<%if (superClass.nSize() == 1){%> extends <%general.name%>Dto<%}else{%> <%}%>
